function* foo1() {
  console.log('bac');
  return 100;
}
const fn1 = foo1();
console.log(fn1);
console.log(fn1.next());

//--------------------------------

function* foo2() {
  console.log(`1`);
  yield 100;//暂停
  console.log(`2`);
  yield 200;//暂停
  console.log(`3`);
  yield 300;//暂停
}

const fn2 = foo2();
console.log(fn2.next());
console.log(fn2.next());
console.log(fn2.next());
console.log(fn2.next());